<template>
	<view class="content">
		<view class="title">
			您的账号：{{shopData.account}}
		</view>
			<u--form labelPosition="left" :model="model" ref="form" labelWidth="200rpx">
			
				<u-form-item label="新密码" leftIcon="lock-fill" leftIconStyle="font-size:40rpx;" labelPosition="top">
					<view class="" style="margin-top: 34rpx;background: rgba(132, 132, 132, .1);border-radius:40rpx;padding: 18rpx;">
						<u--input v-model="model.password" shape="circle" border="none"></u--input>
					</view>
				</u-form-item>
				<u-form-item label="确认密码" leftIcon="lock-fill" leftIconStyle="font-size:40rpx;" labelPosition="top">
					<view class="" style="margin-top: 34rpx;background: rgba(132, 132, 132, .1);border-radius:40rpx;padding: 18rpx;">
						<u--input v-model="model.passwordAgain" shape="circle" border="none"></u--input>
					</view>
					
				</u-form-item>
			</u--form>

		
		<view class="btn" @click="submit">
			确认修改
		</view>
			<Loading></Loading>
			<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	import md5 from '@/util/md5.min.js'
	export default {
		data() {
			return {
				shopData:{},
				password:'',
				passwordAgain:''
			}
		},
		onLoad() {
			this.shopData=uni.getStorageSync("userData")  
		},
		methods: {
			submit(){
				let data={
					account:this.shopData.account,
					password:md5(this.password).toUpperCase(),
					passwordAgain:md5(this.passwordAgain).toUpperCase()
				}
				
				this.$myRequest('/api/account/v1/password/update', data,'POST').then(res=>{
					this.$refs.uToast.show({
										type: 'success',
										message: "修改成功",
										complete() {
											uni.navigateBack({
												delta:1
											})
										}
									})
				})
			}
		}
	}
</script>

<style lang="scss">
.content{
	padding: 0 40rpx;
}
	.title{
		font-size: 28rpx;
		text-align: center;
		padding: 30rpx;
	}
	.card{
		padding: 40rpx;
	}
	.btn{	
			background-color: $theme-color;
			width: 478rpx;
			height: 74rpx;
			line-height: 74rpx;
			text-align: center;
			font-size: 28rpx;
			color: #ffffff;
			border-radius: 37rpx;
			
			margin: 0 auto;
			margin-top: 100rpx;
	}
</style>
